<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@page import="com.is.control.EvaluationControl"%>
<%@page import="com.is.model.Evaluation"%>
<%@page import="com.is.control.UserControl"%>
<%@page import="com.is.control.AttendanceDetailControl"%>
<%@page import="com.is.control.AttendanceTimeControl"%>
<%@page import="com.is.control.ParamCourseControl"%>
<%@page import="com.is.model.CourseScore"%>
<%@page import="com.is.control.CourseScoreControl"%>
<%@page import="com.is.control.CourseClassControl"%>
<%@page import="com.is.model.CourseClass"%>
<%@page import="com.is.control.ParamStuyearControl"%>
<%@page import="com.is.control.ParamClassControl"%>
<%@page import="com.is.control.StudentControl"%>
<%@page import="com.is.model.Student"%>
<%@page import="com.is.model.User"%>
<%@page import="com.is.util.ParamUtil"%>
<%@page import="java.util.List"%>
<%@page import="com.is.util.DateTime"%>
<%@page import="com.is.util.DesData"%>
<!DOCTYPE html>
<html>  
<head>
<link href="../../resources/css/default.css" rel="stylesheet" type="text/css" />
<link rel="shortcut icon" href="/InterStu/resources/image/favicon.ico" />
<link href="../../resources/css/common.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../../resources/js/jquery-1.8.1.js"></script>
<script type="text/javascript" src="../../resources/js/jquery.artDialog.js"></script>
<script type="text/javascript" src="../../resources/js/iframeTools.js"></script>
<script>
	function btnPrintClick(){  
		/*打印*/
	 $.dialog({
	    title: '打印学生信息',
	    content: '将进入调用浏览器打印功能，在打印前您可以设置<br/>不打印系统生成的时间、地址等您可能不需要的信息<br>同时根据不同的浏览器调整打印效果',
	    icon: 'warning',
	    ok: function(){
	    	bdhtml=window.document.body.innerHTML;    
		    sprnstr="<!--startprint-->";    
		    eprnstr="<!--endprint-->";    
		    prnhtml=bdhtml.substring(bdhtml.indexOf(sprnstr)+17);    
		    prnhtml=prnhtml.substring(0,prnhtml.indexOf(eprnstr));    
		    window.document.body.innerHTML=prnhtml;    
		    window.print(); 
	    }
	});
	}  
	function resize(printBtn){
		var bodyw = $("body").width();
		var rightl=(bodyw-800)/2; 
		printBtn.css('right',rightl).css('top',300);
	}
	function getBrowser()
	{
	   if(navigator.userAgent.indexOf("MSIE")>0) {
			var browser=navigator.appName;
			var b_version=navigator.appVersion;
			var version=b_version.split(";");
			var trim_Version=version[1].replace(/[ ]/g,"");
			if(browser=="Microsoft Internet Explorer" && trim_Version=="MSIE7.0")
			{
			    return 977;
			}
			    else if(browser=="Microsoft Internet Explorer" && trim_Version=="MSIE6.0")
			{
			    return 977;
			}
				else if(browser=="Microsoft Internet Explorer" && trim_Version=="MSIE8.0")
			{
			    return 960;
			}
			 else{
				return 968;
			}
		}
	    if(isFirefox=navigator.userAgent.indexOf("Firefox")>0){
	        return 970;
	    }
	    if(isSafari=navigator.userAgent.indexOf("Safari")>0) {
	     	return 970; 
	    }
	    if(isCamino=navigator.userAgent.indexOf("Camino")>0){
	     return 970; }
	    if(isMozilla=navigator.userAgent.indexOf("Gecko/")>0){
	     return 990; }
	} 
	$(function(){
		var browser = getBrowser();
		var btn = $(".print");
		resize(btn);
		window.onresize = function(){
			resize(btn);
		};
		var h = $(".page").height();
		$(".pages").height(browser*1);
		if(h<browser*1 || h==browser*1){
			$(".page").css("height",browser*1);
		} else if(browser*1 < h < browser*2){
			$(".page").css("height",browser*2);
		} else{
			$(".page").css("height",browser*3);
		}
	});
</script>
<style>
	.table{border-collapse:collapse;border-spacing:0;border:1px solid #000;; border-padding:0; width:600px; margin:10px auto;height:auto;}
	.title{width:600px; margin:10px auto;text-align:center; font-size:26px;}
	.table td{text-align:center; border:1px solid #000; height:26px;}
	caption{font-size:24px; text-align:center; line-height:34px;margin-top:10px; font-weight:bold; border-top:1px solid #000; border-right:1px solid #000; border-left:1px solid #000;}
	.page{ display:block; }
	.pages{display:block;}
	body{font-size:12px}
	.print{position:fixed; width:50px; height:50px; background:#ccc;}
	.print span{display:block; width:50px; height:50px; line-height:50px; background:#ccc; text-align:center; font-size:14px; color:#fff; cursor:pointer;}
</style>
<title>打印学生信息</title>
</head>
<body>
<% 
	request.setCharacterEncoding("UTF-8");
	String stu = ParamUtil.getString(request,"stu");
	DesData des = new DesData();
	int sid =Integer.parseInt(des.decrypt(stu));
	
	Student s = new Student();
	s = StudentControl.getStudent(sid);
	String[] myStuyears = ParamClassControl.getMyStuyearsByClassId(s.getClassId());
	String defaultPicUrl="../../resources/image/man.GIF";
	String path = "../../User/UserHeadImage/";
	if(sid>0){
%>
<!--startprint-->
	<div class="page">
	<p class='title'>东北师范大学外国留学生预科部学籍表</p>
	<table class="table" border='1' class="table">
			<caption>学生信息&nbsp;&nbsp;&nbsp;Information</caption>
			<tbody>
				<tr>
					<td>护照用名<br/>Passport Name</td>
					<td colspan='2'><%=s.getPassportName() %></td>
					<td>中文姓名<br/>Chinese Name</td>
					<td><%=s.getChineseName() %></td>
				</tr>
				<tr>
					<td>国籍</td>
					<td><%=s.getNationality() %></td>
					<td rowspan='2'>性别<br/>Sex</td>
					<td rowspan='2'>
					<%=(s.getSex().equals("1"))?"男":"女" %>
					</td>
					<td colspan='1' rowspan='6'>
						<img id="imgs" alt="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;照片&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" src="<%=s.getPicPath() %>" width='150' height='150'/> 
					</td>
				</tr>
				<tr>
					<td>Nationality</td>
					<td><%=s.getNationalityEn() %></td>
				</tr>
				<tr>
					<td>出生日期<br/>Date of Birth</td>
					<td><%=s.getBirthday() %></td>
					<td>班级<br/>Class</td>
					<%System.out.print(s.getClassId());%>
					<td><%=ParamClassControl.getClassName(Integer.parseInt(s.getClassId()))%>
					 <%System.out.print(s.getClassId());%>
					</td>
				</tr>
				<tr>
					<td>护照号码<br/>Passport Number</td>
					<td><%=s.getPassportNumber() %></td>
					<td>CSC 号</td>
					<td><%=s.getCscNumber() %></td>
				</tr>
				<tr>
					<td>经费办法<br/>Type of Scholarship</td>
					<td><%=s.getScholarshipType() %></td>
					<td>类别<br/>Level</td>
					<td><%=s.getLevel() %></td>
				</tr>
				<tr>
					<td>专业院校<br/>University</td>
					<td><%=s.getUniversity() %></td>
					<td>专业<br/>Major</td>
					<td colspan='1'><%=s.getMajor() %></td>
				</tr>
				<tr>
					<td>学习时间<br/>Duration of Study</td>
					<td colspan="4">
						<%=s.getDuration() %>
					</td>
				</tr>
				<tr>
					<td>
					其他
					</td>
					<td >
						<%=s.getType() %>
					</td>
					<td>
						备注
					</td>
					<td colspan="2">
						<%=s.getTip() %>
					</td>
				</tr>
			</tbody>
			</table>
			<br/>
			<table class="table">
				<caption>成绩单  Transcript</caption>
			
				<%
				 if(myStuyears!=null&&myStuyears.length>0){
				   for(String stuyear:myStuyears){
					   System.out.print(s.getClassId());
				       if(stuyear!=null&&!stuyear.equals("")){
					   int stuyearId= Integer.parseInt(stuyear);
					   
				%>
				<tr>
					<td colspan="9"><%=ParamStuyearControl.getStuyear(stuyearId).getStuyear()%></td>
				</tr>
				<tr>
					<td rowspan="2" colspan="2">课程名称<br/> Course Type</td>
					<td rowspan="2">总课时<br/> Total Classes</td>
					<td rowspan="2">总缺勤数<br/>Total  Absence</td>
					<td rowspan="1" colspan="3">成绩<br/>  Score</td>
					<td rowspan="2">总成绩<br/> Total Score</td>
					<td rowspan="2">教师<br/>  Teacher</td>
				</tr>
				<tr>
					<td>平时<br/>Daily</td>
					<td>期中<br/>Midterm</td>
					<td>期末<br/>Final</td>
				</tr>
				<%
				 List<CourseClass> uccs = CourseClassControl.getAllCourseClassIdByClassIdAndStuyear(Integer.parseInt(s.getClassId()),stuyearId);
				for(CourseClass cc:uccs){
					CourseScore cs = CourseScoreControl.getCSByStuIdAndCourseId(cc.getId(),s.getId());
				%>
				<tr>
					<td><%=ParamCourseControl.getCourseById(cc.getCourseId()).getCourseName() %></td>
					<td><%=ParamCourseControl.getCourseById(cc.getCourseId()).getCourseNameEn() %></td>
					<td><%= AttendanceTimeControl.getCount(cc.getId(),stuyearId,"","")*2 %></td>
					<td><%=AttendanceDetailControl.getTotalQQByStuIdAndCourseClassIdAndStuyearId(sid,cc.getId(),stuyearId) %></td>
					<%if(cs!=null){%>
					<td><%=cs.getDailyScore() %></td>
					<td><%=cs.getMidtermScore() %></td>
					<td><%=cs.getFinalScore() %></td>
					<td><%=cs.getTotalScore()%></td>
					<%}else{%>
					<td>0.0</td>	
					<td>0.0</td>	
					<td>0.0</td>	
					<td>0.0</td>	
				   <%}
				   String tName = UserControl.getUserById(cc.getUid()).getName();
				   %>
					<td><%=(tName==null||tName.equals("null"))?"":tName %></td>
				</tr>
				<%
				  }
				       }
				}
				}else{
					out.print("<tr><td>暂无记录</td></tr>");
				}%>
			</table>
			</div>
			<%
			Evaluation ce = EvaluationControl.getEvaluationByStuyearAndStuId(sid,ParamStuyearControl.getCurrentStuyearId());
			%>
			<div class="pages">
			<table class="table">
				<caption>HSK</caption>
				<tr style="height:44px;">
					<td width="33%">级别</td>
					<td width="33%">Level</td>
					<td><%out.print((ce!=null)?ce.getLevel():"");%></td>
				</tr>
				<tr  style="height:44px;">
					<td>成绩</td>
					<td>Score</td>
					<td><%out.print((ce!=null)?ce.getScore():"");%></td>
				</tr>
			</table><br/>
			<table class="table">
				<caption>学生评定 Evaluation</caption>
				<tr>
					<td width="50%">教师评语</td>
					<td>Teachers’ Comments</td>
				</tr>
				<tr  style="height:160px;">
					<td colspan = "2">
						<p><%out.print((ce!=null)?ce.getComments():"");%></p>
					</td>
				</tr>
				<tr style="height:50px;">
					<td colspan = "2" style="text-align:right;">班主任（签章）:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br/>Signature&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
				</tr>
				<tr>
					<td>奖惩记录</td>
					<td>Records of Rewards and Punishments</td>
				</tr>
				<tr  style="height:160px;">
					<td colspan = "2">
						<p><%out.print(ce!=null?ce.getRecords():"未找到相关数据");%></p>
					</td>
				</tr>
				<tr style="height:50px;">
					<td colspan = "2" style="text-align:right;">办公室负责人（签章）:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br/>Signature&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
				</tr>
				<tr style="height:50px;">
					<td>
						主管（签章）：
					</td>
					<td>
						东北师范大学外国留学生预科部<br/>&nbsp;年&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;月&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;日
					</td>
				</tr>
			</table>
			</div>
			<div class="pages">
			<table class="table">
				<caption>外国留学人员来华签证申请表<br/>Visa Application for Study in China</caption>
				<tr>
					<td ><img height='824' width='590' src="<%=s.getVisaApplicationPath() %>" /></td>
				</tr>
			</table>
			</div>
			<div class="pages">
			<table class="table">
					<caption>录取通知书&nbsp;Admission notice</caption>
				<tr>
					<td ><img  height='824' width='590'  src="<%=s.getAdmissionPath() %>"  /></td>
				</tr>
			</table>
			</div>
			<div class="pages">
			<table class="table">
					<caption>护照&nbsp;Passport</caption>
				<tr>
					<td><img  height='824' width='590'  src="<%=s.getPassportPath() %>"  /></td>
				</tr>
			</table>
			</div>
			<div class="pages">
			<table class="table">
					<caption>中华人民共和国签证&nbsp;Chinese Visa</caption>
				<tr>
					<td><img  height='824' width='590'  src="<%=s.getChineseVisaPath() %>" /></td>
				</tr>
			</table>
			</div>
			<%}else{
				  out.print("抱歉未能额找到您查找的学生信息");
			} %>
<!--endprint-->
<div class="print"><span id="btnPrint" onclick="btnPrintClick();">打印</span></div>
</body>
</html>